package com.passbook.merchant.convert;

import com.passbook.merchant.api.dto.MerchantDTO;
import com.passbook.merchant.entity.Merchant;
import org.mapstruct.Mapper;
import org.mapstruct.factory.Mappers;

import java.util.List;

@Mapper
public interface MerchantConvert {
    /**
     * 转换类实体
     */
    MerchantConvert INSTANCE = Mappers.getMapper(MerchantConvert.class);

    /**
     * 把dto转换成entity
     */
    Merchant dto2entity(MerchantDTO merchantDTO);

    /**
     * 把entity转换成dto
     */
    MerchantDTO entity2dto(Merchant merchant);

    /**
     * list之间也可以转换，很entity的List转成MerchantDTO list
     */
    List<MerchantDTO> entityList2dtoList(List<Merchant> merchants);
}
